<template>
  <div style="overflow:auto">
    <div>
      <el-container>
        <el-header :data="orderNo" style="margin-top: 20px">
          <label class="number-word" style="margin-left: 20px">订单编号：{{orderNo}}</label>
          <span class="tableTitle" ></span>
        </el-header>
        <el-main>
          <el-row>
            <div>
              <el-card class="box-card" shadow="hover">
                <div slot="header" class="clearfix">
                  <span>客户信息</span>
                </div>
                <div :data="Cusdata" style="text-align:left">
                  <el-row>
                    <el-col :span="8" ><label >客户编号：{{Cusdata.customerNo}}</label></el-col>
                    <el-col :span="8" ><label >单位名称：{{Cusdata.customerName}}</label></el-col>
                    <el-col :span="8" ><label >联系人：{{Cusdata.linkPerson}}</label></el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="8" ><label >联系方式：{{Cusdata.linkPhone}}</label></el-col>
                    <el-col :span="8" ><label >所属区域：{{Cusdata.areaName}}</label></el-col>
                    <el-col :span="8" ><label >传真：{{Cusdata.fax}}</label></el-col>
                  </el-row>
                </div>
              </el-card>
            </div>
          </el-row>
          <el-row>
            <el-card shadow="hover" class="box-card" >
              <div slot="header">
                <span>订单信息</span>
              </div>
              <div :data="Orderdata"  style="text-align:left">
                <el-row>
                  <el-col :span="8" ><label >订单编号：{{Orderdata.orderNo}}</label></el-col>
                  <el-col :span="8" ><label >下单时间：{{Orderdata.orderTime}}</label></el-col>
                  <el-col :span="8" ><label >订单金额：{{Orderdata.finalTotal}}</label></el-col>
                </el-row>
                <el-row>
                  <el-col :span="8" ><label >订单状态：</label>
                    <span v-if="Orderdata.orderStatus === 0">生成中</span>
                    <span v-else-if="Orderdata.orderStatus === 3">已取消</span>
                    <span v-else-if="Orderdata.orderStatus === 7">已出库</span>
                    <span v-else>已完成</span>
                  </el-col>
                  <el-col :span="8" ><label >收货公司：{{Orderdata.customerName}}</label></el-col>
                  <el-col :span="8" ><label >客户备注：{{Orderdata.remark}}</label></el-col>
                </el-row>
                <el-row>
                  <el-col :span="8" ><label >订单交期：{{Orderdata.leadtime}}</label></el-col>
                </el-row>
              </div>
            </el-card>
          </el-row>
          <el-row>
            <el-card shadow="hover" class="box-card" >
              <div slot="header">
                <span>发票信息</span>
              </div>
              <div :data="Orderdata"  style="text-align:left">
                <label>{{Orderdata.invoiceInfo}}</label>
              </div>
            </el-card>
          </el-row>
          <el-row>
            <el-card shadow="hover" class="box-card" >
              <div slot="header">
                <span>订单明细</span>
                <div>
                  <el-table
                    :data="OrDetaildata"
                    style="width: 100%">
                    <el-table-column
                      prop="productNo"
                      label="产品编号"
                      width="150">
                    </el-table-column>
                    <el-table-column
                      prop="productName"
                      label="产品名称"
                      width="180">
                    </el-table-column>
                    <el-table-column
                      prop="spec"
                      label="产品规格"
                      width="180">
                    </el-table-column>
                    <el-table-column
                      prop="unit"
                      label="单位"
                      width="80">
                    </el-table-column>
                    <el-table-column
                      prop="orderAmount"
                      label="产品数量"
                      width="100">
                    </el-table-column>
                    <el-table-column
                      prop="amount"
                      label="总计数量"
                      width="100">
                    </el-table-column>
                    <el-table-column
                      prop="price"
                      label="单价"
                      width="80">
                    </el-table-column>
                    <el-table-column
                      prop="total"
                      label="总计金额"
                      width="180">
                    </el-table-column>
                    <el-table-column
                      prop="finalTotal"
                      label="实际金额"
                      width="180">
                    </el-table-column>
                  </el-table>
                </div>
              </div>
            </el-card>
          </el-row>
          <el-row>
            <el-card shadow="hover" class="box-card" >
              <div slot="header">
                <span>订单配送</span>
              </div>
              <div :data="Orderdata"  style="text-align:left">
                <label>{{Orderdata.logisticinfo}}</label>
              </div>
            </el-card>
          </el-row>
        </el-main>
        <el-footer>
          <el-button type="primary" @click="goback">返回</el-button>
        </el-footer>
      </el-container>
    </div>

  </div>
</template>

<script>
  export default {
    name: "orderdetail",
    data(){
      return {
        OrDetaildata: [],
        Orderdata: [],
        Cusdata: [],
        orderNo:"",
        customerNo:""
      }
    },
    created(){
      this.orderNo=this.$route.query.orderNo
      this.customerNo=this.$route.query.customerNo
      this.xuanran()
    },
    methods: {
      xuanran() {
        let params={
          "orderNo":this.orderNo,
        }
        this.$http.post("/hnhyscms_ws/orderdetails/getByOrderNo",params, {emulateJSON: true}).then(
          success => {
            this.OrDetaildata = success.data
          }
        )
        this.$http.post("/hnhyscms_ws/orders/getByOrderNo",params, {emulateJSON: true}).then(
          success => {
            console.log(success.data)
            this.Orderdata = success.data
          }
        )
        let param={
          "customerNo":this.customerNo,
        }
        this.$http.post("/hnhyscms_ws/customers/getByCustomerNo",param, {emulateJSON: true}).then(
          success => {
            this.Cusdata = success.data
          }
        )
      },
      goback(){
        this.$router.go(-1)
      }
    }
  }
</script>

<style scoped>
  .box-card {
    margin:20px 20px 20px 20px;
  }
  .number-word {
    font-size: 30px;
    line-height:50px;
    margin-left: -1300px;
  }
  .tableTitle {
    margin: 0 auto;
    width: 600px;
    height: 1px;
    background-color: #d4d4d4;
    color: rgb(0, 0, 0);
  }
</style>
